// pages/record_1/record_1.js
var app = getApp()
var WxParse = require('../../../wxParse/wxParse.js');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    current: '',
    none: [{ img: "https://lg-o8nytxik-1257013711.cos.ap-shanghai.myqcloud.com/微信图片_20180727121929.png", con: "暂无信息" }],
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this
    var val = JSON.parse(options.obj);
    console.log(val)
    var bgc = wx.getStorageSync('color')
    wx.setNavigationBarColor({
      frontColor: "#ffffff",
      backgroundColor: bgc,
    })
    that.setData({
      val: val,
      backgroundColor: bgc
    })
  },
  //下一步
  nextClick: function (e) {
    console.log(e)
    var that = this
    var val = JSON.stringify(that.data.val)
    var id = e.currentTarget.dataset.id
    console.log(val)
    wx.navigateTo({
      url: '/hyb_yl/mysubpages/pages/record_2/record_2?con=' + e.currentTarget.dataset.con + '&id=' + id + '&val=' + val,
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    this.getBase()
    this.getCategoryf1()
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },
  getBase: function () {
    var that = this
    app.util.request({
      'url': 'entry/wxapp/Base',
      success: function (res) {
        that.setData({
          baseinfo: res.data.data,
        })
        WxParse.wxParse('articles', 'html', res.data.data.yy_content, that, 5);
      },
      fail: function (err) {
        console.log(err)
      },
    })
  },
  //查询父类
  getCategoryf1: function () {
    var that = this
    app.util.request({
      'url': 'entry/wxapp/Categoryf1',
      success: function (res) {
        console.log(res)
        that.setData({
          items: res.data.data,
        })
      },
      fail: function (err) {
        console.log(err)
      },
    })
  }
})